<?php

/**
 * Order class
 * @package mobi.application.modules.admin
 * @author xoannt
 */
class Order extends MY_Controller{
    protected $table = 'tbl_order';
    protected $col_id = 'order_id';
    /**
 * construct
 * 
 * @access public
 */
    public function __construct() {
        parent::__construct();
        $this->load->model('order_model');
    }
/**
 * view order
 * 
 * @access public
 */
    public function index()
    {
        
        if($this->input->post('filter')) 
        {
            $from = $this->input->post('from');
            $to = $this->input->post('to');
            if($from != '' && $to != '')
            {
                $data['list_order'] = $this->order_model->order_filter($from, $to);
                $data['from'] = $from;
                $data['to'] = $to;
                $this->layout('order/index', $data);
            }
            else
            {
                $data['list_order'] = $this->order_model->list_order();
                $this->layout('order/index', $data);
            }
        }
        else 
        {
            $data['list_order'] = $this->order_model->list_order();
            $this->layout('order/index', $data);
        }
        
    }
    public function order_detail($order_id = '')
    {
        $data['order_info'] = $this->order_model->order_info($order_id);
        $this->layout('order/details', $data);
    }
    public function repost()
    {
        $data['repost'] = $this->order_model->repost();
        
        $this->layout('order/repost', $data);
    }
}
 
